<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<title>我的订单</title>
<link href="${pageContext.request.contextPath}/bettery/css/itao.css"	rel="stylesheet" />
<script type="text/javascript" src="${pageContext.request.contextPath}/dewei/js/jquery.js"></script>
<script type="text/javascript"	src="${pageContext.request.contextPath}/bettery/js/template.js"></script>
<style type="text/css">
ul.products {
	margin: 0px;
	list-style: none;
	padding: 0px;margin-top: 10px;
}
ul.products li {
	border-bottom: 1px solid rgba(0, 0, 0, 0.2);
	
	font-size: 13px;
	padding: 3px 5px;
}

ul.products li:hover {
	background: rgba(0, 0, 0, 0.2);
}

ul.products li img,ul.products li .info,ul.products li .oper {
	display: inline-block;vertical-align: middle;
}
ul.products li .btn{
	float: right;height: 30px;margin-top: 10px;
}
</style>
</head>
<body>
	<div class='search_bar'>
		<span>订单信息</span>
	</div>
	<div id="contentList">
	</div>
	<script id="test" type="text/html">
		<ul class="products">
			 {{each list as value i}}
				<li>
				   <div>
					<img xSrc="{{value.imageUrl}}" src="${pageContext.request.contextPath}/dewei/img/wait.gif" style="top: 0px;" width="72" height="72">
					<div class='info'>
						<div>
							订&nbsp;单&nbsp;号：{{value.dingDanUid}}
						</div>
						<div>
							电池品牌：{{value.pinPai}}
						</div>
						<div>
							电池型号：{{value.xingHao}}
						</div>
						<div>
							换购价格：{{value.price}}元
						</div>
						
						{{if '附近门店更换' == value.changeType}}
						</div>
						<hr/>
						<div>
						店&nbsp;&nbsp;名：{{value.mendianName}}
						</div>
						<div>
						<div >
						<table border="0px;" cellpadding="0px;" cellspacing="0px;"><tr><td  style='vertical-align: top;width:40px;'>地&nbsp;&nbsp;址：</td><td>{{value.mendianAddr}}</td></tr></table>
						</div>
						<div>
							联系人：{{value.mendianLxr}}
						</div>
						<div>
							联系电话：{{value.menDianTel}}
						</div>
						<div>
							此订单有效期至{{value.invalidDate}}。
						</div>
						</div>
						{{/if}}
						{{if '人工上门更换' == value.changeType}}
						</div>
						 <hr/>
						  <div>
							上门服务：{{value.serverPrice}}元
						  </div>
						<div>
						<div>
							此订单有效期至{{value.invalidDate}}。
						</div>
						</div>
						{{/if}}
						{{if '附近无网点' == value.changeType}}
						 <hr/>
						</div>
						<div>
						您附近无网点，
						请等待客服与您联系<br>
						服务热线：400-990-5660
						</div>
						{{/if}}
						<a style="display: inline;color: red;"> 
						{{if '0' == value.state}}
							已下单
						{{else if '1' == value.state}}
							已完成
						{{else if '2' == value.state}}
							已指派
						{{else if '3' == value.state}}
							已作废
						{{else if '4' == value.state}}
							已超期
						{{else if '5' == value.state}}
							已核实
						{{else}}
							处理中
						{{/if}}
						
						</a>
						</div>
					</div>
				</li>
			 {{/each}}
		</ul>
		</script>
		<script>
		var diandansListJson =${dingdansJson};
		var data = {
			list: diandansListJson
		};
		if(null!=diandansListJson&&diandansListJson.length>0){
			var html = template('test', data);
			document.getElementById('contentList').innerHTML = html;
		}
		</script>
		<script type="text/javascript">
    var scrollLoad = (function (options) {
        var defaults = (arguments.length == 0) ? { src: 'xSrc', time: 300} : { src: options.src || 'xSrc', time: options.time ||300};
        var camelize = function (s) {
            return s.replace(/-(\w)/g, function (strMatch, p1) {
                return p1.toUpperCase();
            });
        };
        this.getStyle = function (element, property) {
            if (arguments.length != 2) return false;
            var value = element.style[camelize(property)];
            if (!value) {
                if (document.defaultView && document.defaultView.getComputedStyle) {
                    var css = document.defaultView.getComputedStyle(element, null);
                    value = css ? css.getPropertyValue(property) : null;
                } else if (element.currentStyle) {
                    value = element.currentStyle[camelize(property)];
                }
            }
            return value == 'auto' ? '' : value;
        };
        var _init = function () {
            var offsetPage = window.pageYOffset ? window.pageYOffset : window.document.documentElement.scrollTop,
                offsetWindow = offsetPage + Number(window.innerHeight ? window.innerHeight : document.documentElement.clientHeight),
                docImg = document.images,
                _len = docImg.length;
            if (!_len) return false;
            for (var i = 0; i < _len; i++) {
                var attrSrc = docImg[i].getAttribute(defaults.src),
                    o = docImg[i], tag = o.nodeName.toLowerCase();
                if (o) {
                    postPage = o.getBoundingClientRect().top + window.document.documentElement.scrollTop + window.document.body.scrollTop; postWindow = postPage + Number(this.getStyle(o, 'height').replace('px', ''));
                    if ((postPage > offsetPage && postPage < offsetWindow) || (postWindow > offsetPage && postWindow < offsetWindow)) {
                        if (tag === "img" && attrSrc !== null) {
                            o.setAttribute("src", attrSrc);
                        }
                        o = null;
                    }
                }
            };
            window.onscroll = function () {
                setTimeout(function () {
                    _init();
                }, defaults.time);
            }
        };
        return _init();
    });
    scrollLoad();
</script> 
	</body>
</html>
